name: PullRequestApprovedCI

env:
  # Force the stdout and stderr streams to be unbuffered
  PYTHONUNBUFFERED: 1

on:  # yamllint disable-line rule:truthy
  pull_request_review:
    types:
      - submitted

jobs:
  MergeOnApproval:
    runs-on: [self-hosted, style-checker]
    steps:
      - name: Check out repository code
        uses: ClickHouse/checkout@v1
        with:
          clear-repository: true
      - name: Merge approved PR
        run: |
          cd "$GITHUB_WORKSPACE/tests/ci"
          python3 merge_pr.py --check-approved
